<!--/**
 * Plugin Name: 论坛展示型app
 * Description: uloug.com To develop and share! Please keep the copyright information!
 * Author: 拾讯网
 * Author URI: http://www.uloug.com
 * Version: 1.0
 * Plugin URI: https://git.oschina.net/858598758/apicloud.mao10.app.demo.git
 * License: GPL2+
 */-->
<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<link rel="stylesheet" type="text/css" href="../css/aui.css" />
	</head>
	<body>
		<header class="aui-bar aui-bar-nav aui-bar-warning" id="aui-header">
			<a id="disp-no" class="aui-pull-left" style="display: none;" tapmode onclick="opensetup()"> <span class="aui-iconfont aui-icon-settings"></span> </a>
			<div id="header-title">
				拾味生活
			</div>
			<a id="disp-no1" class="aui-pull-right" style="display: none;" tapmode onclick="news()"> <span class="aui-iconfont aui-icon-message"></span> </a>
		</header>
		<footer class="aui-nav" id="aui-footer">
			<ul class="aui-bar-tab">
				<li class="active-warning" id="tabbar1" tapmode onclick="randomSwitchBtn(this,'首页',0)">
					<span class="aui-iconfont aui-icon-favor"></span>
					<p>
						首页
					</p>
				</li>
				<!--li id="tabbar2" tapmode onclick="randomSwitchBtn(this,'发现',1)">
				<span class="aui-iconfont aui-icon-mark"></span>
				<p>发现</p>
				</li -->
				<li id="tabbar2" tapmode onclick="openfind()">
					<span class="aui-iconfont aui-icon-mark"></span>
					<p>
						发现
					</p>
				</li>
				<li id="tabbar3" tapmode onclick="openshop()">
					<span class="aui-iconfont aui-icon-like"></span>
					<p>
						商城
					</p>
				</li>
				<li id="tabbar4" tapmode onclick="randomSwitchBtn(this,'信息',1)">
					<span class="aui-iconfont aui-icon-comment"></span>
					<p>
						信息
					</p>
				</li>
				<li id="tabbar5" tapmode onclick="randomSwitchBtn(this,'我的',2)">
					<span class="aui-iconfont aui-icon-my"></span>
					<p>
						我的
					</p>
				</li>
			</ul>
		</footer>
	</body>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript">
		apiready = function() {
			api.parseTapmode();
			var header = $api.byId('aui-header');
			$api.fixStatusBar(header);
			var headerPos = $api.offset(header);
			var body_h = $api.offset($api.dom('body')).h;
			var footer_h = $api.offset($api.byId('aui-footer')).h;
			api.openFrameGroup({
				name : 'footer_tab_demo',
				scrollEnabled : false,
				rect : {
					x : 0,
					y : headerPos.h,
					w : 'auto',
					h : body_h - headerPos.h - footer_h
				},
				index : 0,
				preload : 2,
				frames : [{
					name : 'home_index',
					url : 'html/home/home_win.html',
					bounces : true
				}, /*{
				 name: 'find',
				 url: 'find/find_frm.html',
				 bounces:false
				 },
				 {
				 name : 'footer_tab_3',
				 url : 'footer_tab_3.html',
				 bounces : true
				 },*/
				{
					name : 'main_do1',
					url : 'html/main_do1.html',
					bounces : true
				}, {
					name : 'user',
					url : 'html/user/user_win.html',
					bounces : true
				}]
			}, function(ret, err) {
				var footer = $api.byId('aui-footer');
				var footerAct = $api.dom(footer, '.aui-bar-tab li.active-warning');
				$api.removeCls(footerAct, 'active-warning');
				var name = ret.name;
				var index = ret.index;
				if (index == 0) {
					$api.text($api.byId('header-title'), '首页');
					$api.addCls($api.byId('tabbar1'), 'active-warning');
					/*隐藏我的*/
					$api.addCls($api.byId('aui-header'), 'aui-bar-warning');
					$api.removeCls($api.byId('aui-header'), 'aui-bar-primary');
					$api.removeCls($api.byId('header-title'), 'aui-title');
					$api.byId('disp-no').style.display = "none";
					$api.byId('disp-no1').style.display = "none";
				}/* else if(index==1){
				 $api.text($api.byId('header-title'),'发现');
				 $api.addCls($api.byId('tabbar2'), 'active-warning');
				 }else if (index == 1) {
				 $api.text($api.byId('header-title'), '商城');
				 $api.addCls($api.byId('tabbar3'), 'active-warning');
				 /*隐藏我的*//*
				 $api.addCls($api.byId('aui-header'), 'aui-bar-warning');
				 $api.removeCls($api.byId('aui-header'), 'aui-bar-primary');
				 $api.removeCls($api.byId('header-title'), 'aui-title');
				 $api.byId('disp-no').style.display="none";
				 $api.byId('disp-no1').style.display="none";
				 }*/else if (index == 1) {
					$api.text($api.byId('header-title'), '信息');
					$api.addCls($api.byId('tabbar4'), 'active-warning');
					/*隐藏我的*/
					$api.addCls($api.byId('aui-header'), 'aui-bar-warning');
					$api.removeCls($api.byId('aui-header'), 'aui-bar-primary');
					$api.removeCls($api.byId('header-title'), 'aui-title');
					$api.byId('disp-no').style.display = "none";
					$api.byId('disp-no1').style.display = "none";
				} else if (index == 2) {
					$api.text($api.byId('header-title'), '我的');
					$api.addCls($api.byId('tabbar5'), 'active-warning');
					/*增加hd左右*/
					$api.addCls($api.byId('aui-header'), 'aui-bar-primary');
					$api.removeCls($api.byId('aui-header'), 'aui-bar-warning');
					$api.addCls($api.byId('header-title'), 'aui-title');
					$api.byId('disp-no').style.display = "";
					$api.byId('disp-no1').style.display = "";
				}
			})
		}
		/*function closeWin() {
		 api.closeWin();
		 }*/
		function randomSwitchBtn(obj, name, index) {
			$api.text($api.byId('header-title'), name);
			var footer = $api.byId('aui-footer');
			var footerAct = $api.dom(footer, '.aui-bar-tab li.active-warning');
			$api.removeCls(footerAct, 'active-warning');
			$api.addCls(obj, 'active-warning');
			api.setFrameGroupIndex({
				name : 'footer_tab_demo',
				index : index,
				scroll : true
			});
		}

		function openfind() {
			var delay = 0;
			if (api.systemType != 'ios') {
				delay = 300;
			}
			api.openWin({
				name : 'find_win',
				url : 'html/find/find_win.html',
				bounces : true,
				delay : delay,
				slidBackType : false,
				slidBackEnabled : true,
				vScrollBarEnabled : false
			});
		}

		function opensetup() {
			var delay = 0;
			if (api.systemType != 'ios') {
				delay = 300;
			}
			api.openWin({
				name : 'set_win',
				url : 'html/user/set_win.html',
				bounces : true,
				delay : delay,
				slidBackEnabled : true,
				vScrollBarEnabled : false
			});
		}

		function openshop() {
			var delay = 0;
			if (api.systemType != 'ios') {
				delay = 300;
			}
			api.openWin({
				name : 'shop_home_win',
				url : 'html/shop/shop_home_win.html',
				bounces : false,
				delay : delay,
				slidBackType : false,
				slidBackEnabled : true,
				vScrollBarEnabled : false
			});
		}
		function news() {
			var delay = 0;
			if (api.systemType != 'ios') {
				delay = 300;
			}
			api.openWin({
				name : 'news_win',
				url : 'html/news/news_win.html',
				bounces : false,
				delay : delay,
				slidBackEnabled : true,
				vScrollBarEnabled : false
			});
		}
	</script>
</html>